package com.example.mybatis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.mybatis.entity.UserInfo;
import com.example.mybatis.mapper.UserInfoMapper;
import com.example.mybatis.mapper.biz.BizUserInfoMapper;
import com.example.mybatis.service.IUserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
public class UserInfoServiceImpl implements IUserInfoService {

    private final UserInfoMapper userInfoMapper;
    private final BizUserInfoMapper bizUserInfoMapper;

    public UserInfoServiceImpl(UserInfoMapper userInfoMapper,
                               BizUserInfoMapper bizUserInfoMapper) {
        this.userInfoMapper = userInfoMapper;
        this.bizUserInfoMapper = bizUserInfoMapper;
    }

    @Override
    public List<UserInfo> userList() {

//        QueryWrapper<UserInfo> userInfoQueryWrapper = new QueryWrapper<>();
//        userInfoQueryWrapper.eq("name", "a");
        LambdaQueryWrapper<UserInfo> userInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        userInfoLambdaQueryWrapper.eq(UserInfo::getUserName, "a");
        List<UserInfo> userInfoList = userInfoMapper.selectList(userInfoLambdaQueryWrapper);
        return userInfoList;
    }

    @Override
    public List<UserInfo> getUserList() {
        List<UserInfo> userList = bizUserInfoMapper.getUserList();
        return userList;
    }
}
